package com.smtlive.repository;

import java.util.ArrayList;

import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;

import com.smtlive.domain.Role;
import com.smtlive.domain.UserRole;

@Repository
public interface UserRoleRepository extends CrudRepository<UserRole, Long>  {

	ArrayList<UserRole> findByUserId(long id);

	@Query("select role from UserRole userRole, Role role where userRole.userId = ?1 and role.roleId = userRole.roleId")
	ArrayList<Role> findRoles(long userid);
}
